Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid reinstalling installonly packages marked for ERASE #850

Merged

Conversation

@kontura
Copy link
Contributor Author

kontura commented Oct 5, 2023

Back-ported tests: rpm-software-management/ci-dnf-stack#1392

@j-mracek j-mracek self-assigned this Oct 10, 2023
@@ -270,6 +284,7 @@ bool GoalPrivate::limit_installonly_packages(libdnf5::solv::IdQueue & job, Id ru

const InstallonlyCmpData installonly_cmp_data{spool, running_kernel};
q.sort(&installonly_cmp, &installonly_cmp_data);
std::sort(available_unused_providers.begin(), available_unused_providers.end(), nevra_solvable_cmp_key);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am not mistaken, the original patch for libdnf uses name cmp key and not nevra for both - sorting and lower_bound. May I ask you why is there a different implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I forgot about that.
I think I added that just because nevra_solvable_cmp_key is already implemented.
I can add a new function to compare just the names if you prefer that?
The arch and evr sorting is not needed here so it would be more efficient.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sorting using only name will be more efficient, but sorting by NEVRA is not wrong. Please feel free to implement it according to your preferences.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I have added the new comparator for names only.

I have also rebased the PR.

Without this patch reinstalling installonly pkg marked for ERASE might
be a valid smallest solution to our job.

For example when user wants to install through a provide we select all
packages that provide it and put them inside a `job install oneof ...`
if one of the providers is also marked for ERASE due to installonly
limit libsolv might decide to reinstall it.

To make sure it doesn't happen mark the available package also as ERASE.

openSUSE/libsolv#540

https://bugzilla.redhat.com/show_bug.cgi?id=2163474
https://issues.redhat.com/browse/RHEL-1253
@kontura kontura force-pushed the avoid_reinstalling_installonly branch from f4f3363 to 8f878ac Compare October 16, 2023 06:41
Copy link
Contributor

@j-mracek j-mracek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@j-mracek j-mracek added this pull request to the merge queue Oct 17, 2023
Merged via the queue into rpm-software-management:main with commit dab978c Oct 17, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants